#include <head.h>

int main(int argc, char const *argv[])
{
    pid_t pid;

    pid = fork();

    if (pid == -1)
    {
        ERRLOG("进程创建失败\n");
    }
    else if (pid > 0)
    {
        while (1)
        {
            printf("小谭最帅\n");
            sleep(1);
            
            int __stat_loc;
            waitpid(pid , &__stat_loc , WNOHANG);
            if (WIFEXITED(__stat_loc))
            {
                printf("返回值的为%d\n" ,WEXITSTATUS(__stat_loc));
            }
            if (WIFSIGNALED(__stat_loc))
            {
                printf("信号值的为%d\n" , WTERMSIG(__stat_loc));
            }
            
            
        }

        
    }
            else if (pid == 0)
        {
            printf("我是子进程 我的pid = %d\n" , getpid());
            printf("我是子进程 我的ppid =%d\n",getppid());

            sleep(5);
            printf("我是子进程 我结束了\n");
            exit(10);
        }
    
    return 0;
}